<!--- Document Information -----------------------------------------------------

Title:      HibernateFactory.cfc

Author:     Mark Mandel
Email:      mark@compoundtheory.com

Website:    http://www.compoundtheory.com

Purpose:    Factory for getting to Hibernate objects

Usage:      

Modification Log:

Name			Date			Description
================================================================================
Mark Mandel		27/06/2006		Created

------------------------------------------------------------------------------->

<cfcomponent name="HibernateSession" hint="session facade">

<cfscript>
	instance = StructNew();
</cfscript>

<cffunction name="init" hint="Constructor: returns this" access="public" returntype="any" output="false">
	<cfargument name="session" hint="session" type="any" required="Yes">
	<cfscript>
		this = arguments.session.openSession();
	</cfscript>
</cffunction>

<!------------------------------------------- PUBLIC ------------------------------------------->


<cffunction name="load" hint="returns hibernate config object" access="public" returntype="any" output="false">
	<cfargument name="obj">
	<cfargument name="val">
	<cfreturn this.load(obj,val) />
</cffunction>

<!------------------------------------------- PACKAGE ------------------------------------------->

<!------------------------------------------- PRIVATE ------------------------------------------->

<cffunction name="throwerror">
  <cfargument name="type" required="true" />
  <cfargument name="message" default="" />
	<cfthrow type="#arguments.type#" message="#arguments.message#" />
</cffunction>

<cffunction name="dumpvar">
  <cfargument name="var">
  <cfargument name="abort" default="true">
  <cftry>
<!---
 		<cfset class = createObject("java","java.lang.Class") />
		<cfset meths = var.getDeclaredMethods() />
		<cfset ms = structNew() />
		<cfloop from="1" to="#arrayLen(meths)#" index="m">
		  <cfset ms[meths[m].toString()] = structNew() />
		  <cfset ms[meths[m].toString()]["public"] = meths[m].public>
		  <cfset mps = meths[m].getParameterTypes()>
			<cfloop from="1" to="#arrayLen(mps)#" index="p">
			  <cfset ms[meths[m].toString()][mps[p].getName()] = mps[p].getName() />
			</cfloop>
		</cfloop>
	  <cfdump var="#ms#" />
--->
	  <cfdump var="#var#" />
	<cfcatch>
	  <cfset writeoutput(cfcatch.Message & " " & cfcatch.Detail & " " & cfcatch.TagContext[1].line & " " & cfcatch.stacktrace) />
	</cfcatch>
	</cftry>
	<cfif arguments.abort>
	  <cfabort />
	</cfif>
</cffunction>


</cfcomponent>